import request from "@/utils/request";
import { AxiosPromise } from "axios";
import qs from "qs";

interface LoginParams {
  phone: string;
  password: string;
}

export const login = (data: LoginParams): AxiosPromise => {
  return request({
    method: "POST",
    url: "/front/user/login",
    data: qs.stringify(data),
  });
};

export const getInfo = (): AxiosPromise => {
  return request({
    method: "GET",
    url: "/front/user/getInfo",
  });
};

interface UserParams {
  name: string;
  url: string;
  region: string;
  current: number;
  size: number;
}
export const getUserPages = (data: UserParams): AxiosPromise => {
  return request({
    method: "POST",
    url: "/boss/resource/getResourcePages",
    data,
  });
};
